int cmp_int(const void* e1, const void* e2)//void* 无具体类型指针 不能解引用
{
    return (*(int*)e1 - *(int*)e2);//升序
}
int longestConsecutive(int* nums, int numsSize)
{
    int len = 0, max_len = 0;
    qsort(nums, numsSize, sizeof(int),cmp_int);
    if(numsSize == 0)
    return 0;
    for(int i = 1; i < numsSize; i++)
    {
        if(nums[i] - nums[i - 1] == 1)
        {
            len++;
        }
        else if(nums[i] - nums[i - 1] == 0)
        {
            ;
        }
        else
        {
            max_len = len > max_len ? len : max_len;
            len = 0;
        }
    }
    max_len = len > max_len ? len : max_len;
    return max_len + 1;   
}
